package com.siscoe.web.managedbean;

import java.io.IOException;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;



/**
 * Class bean login
 * @author manuonda
 *
 */
@ManagedBean(name="beanLogin")
@RequestScoped
public class LoginBean {
	
	
	private String username;
	private String password;
	
	
	public void action() throws IOException
	{
		
		
		if(getUsername().equals("admin") && getPassword().equals("admin"))
		{
			System.out.println("acceso sistema");
			
		    ExternalContext ec=FacesContext.getCurrentInstance().getExternalContext();
		    ec.redirect(ec.getRequestContextPath()+"/views/panel.xhtml");
	   
		}
		else
		{
			System.out.println("no acceso sistema");
		}
		
	}


	public String getUsername() {
		return username;
	}


	public void setUsername(String username) {
		this.username = username;
	}


	public String getPassword() {
		return password;
	}


	public void setPassword(String password) {
		this.password = password;
	}
	
	

}
